import java.util.Scanner;

public class Demo5 {

    public static void main(String[] args) {

        Object lock1 = new Object();
        Object lock2 = new Object();

        Thread t1 = new Thread(() -> {
            {

            System.out.println("wait 之前");

            try {
                Thread.sleep(10000);
            synchronized (lock1) {


                lock1.wait();
            }
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }

            System.out.println("wait 之后");
        });

        Thread t2 = new Thread(() -> {

            Scanner sc = new Scanner(System.in);
            int p = 0;
            System.out.println("输入数字");
            sc.nextInt();

            synchronized (lock1) {
                lock1.notify();
            }
        });

        t1.start();
        t2.start();
    }
}
